package cn.itcast.dao;

import cn.itcast.domain.kehu;
import com.sun.org.apache.xpath.internal.operations.Bool;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface kehuDao {
    // 查询所有入住的账户
    @Select("select * from kehu where OutTime is null")
    public List<kehu> findAllkehu();

    @Select("select * from kehu where num =#{num} order by OutTime limit 1")
    public kehu findkehuByNum(Integer num);

    @Select("select * from kehu where Id_num = #{Id_num}")
    public kehu findkehuById(String Id_num);

    @Update("update kehu set num=#{num},InTime=#{InTime},name=#{name},OutTime=#{OutTime} where Id_num = #{Id_num}")
    public void updatekehu(kehu kh);

    @Insert("insert into kehu values (#{Id_num},#{name},#{num},#{InTime},#{OutTime})")
    public void insertkehu(kehu kh);

    @Select("select * from kehu where name = #{name}")
    public kehu findkehuByName(String name);
}
